package com.testDemo.lang;

import com.google.common.collect.Lists;
import org.junit.jupiter.api.Test;

import java.util.List;

/**
 * @author: zouren
 * @date: 2022/7/12
 * @description:
 */
public class BreakTest {
    @Test
    public void aaa(){
        List a = Lists.newArrayList("a1","a2","a3","a4","a5","a6");
        List b = Lists.newArrayList("b1","b2","b3","b4","b5","b6");
        List<List<String>> all = Lists.newArrayList(a,b);
        List<String> re =  Lists.newArrayList();
        for (int i = 0; i < all.size(); i++) {
            List<String> row = all.get(i);
            for (int j = 0; j < row.size(); j++) {
                System.out.println(row.get(j));
                re.add(row.get(j));
                if("a3".equals(row.get(j))){
                    return ;
                }
            }
        }
    }

    public List<String>  bbb(){
        List a = Lists.newArrayList("a1","a2","a3","a4","a5","a6");
        List b = Lists.newArrayList("b1","b2","b3","b4","b5","b6");
        List<List<String>> all = Lists.newArrayList(a,b);
        List<String> re =  Lists.newArrayList();
        for (int i = 0; i < all.size(); i++) {
            List<String> row = all.get(i);
            for (int j = 0; j < row.size(); j++) {
                System.out.println(row.get(j));
                re.add(row.get(j));
                if("a3".equals(row.get(j))){
//                    return ;
                }
            }
        }
        return re;
    }
}
